public class practise {
    public static void main1(String[] args) {
        //打印1-10用while循环
        int i=1;
        while(i<=10) {
            System.out.println(i);
            i++;
        }
    }

    public static void main2(String[] args) {
        //计算1-100的和
        int i =1;
        int sum =0;
        while(i<=100) {
            sum+=i;
            i++;
        }
        System.out.println(sum);
    }

    public static void main3(String[] args) {
         //计算5的阶乘
        int i=1;
        int ret =1;
        while(i<=5) {
            ret*=i;
            i++;
        }
        System.out.println(ret);
    }

    public static void main4(String[] args) {
        //计算1!+2!+3!+4!+5!
        int num =1;
        int sum =0;
        while(num<=5) {
            int ret =1;
            int i=1;
            while(i<=num) {
                ret*=i;
                i++;
            }
            sum+=ret;
            num++;
        }
        System.out.println(sum);
    }

    public static void main5(String[] args) {
       //找到100-200之间第一个3的倍数
        int num =100;
        while(num<=200) {
            if(num%3==0) {
                System.out.println(num);
                break;
            }
            num++;
        }
    }

    public static void main6(String[] args) {
        //利用for循环求1-10之间的和
        int i =0;
        int sum =0;
        for(i=1;i<=10;i++) {
            sum+=i;
        }
        System.out.println(sum);
    }

    public static void main7(String[] args) {
        //利用for循环求5！
        int i=0;
        int ret =1;
        for(i=1;i<=5;i++) {
            ret*=i;
        }
        System.out.println(ret);
    }

    public static void main8(String[] args) {
        //计算1！+2！+3！+4！+5！
        int sum =0;
        for(int i=1;i<=5;i++) {
            int ret =1;
            for(int j=1;j<=i;j++) {
                ret*=j;
            }
            sum+=ret;
        }
        System.out.println(sum);
    }






}
